﻿@model IEnumerable<AspNetMvc.Demo1.Models.Book>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink((string)ViewBag.CreateLink, "Create")
</p>
<table>
    <tr>
        <th>
            @Html.ActionLink((string)ViewBag.TitleDisplay,"Index", new{sortOrder = ViewBag.TitleSortParam})
        </th>
        <th>
            @Html.ActionLink((string)ViewBag.IsbnDisplay,"Index", new{sortOrder = ViewBag.IsbnSortParam})
        </th>
        <th>
            @ViewBag.SummaryDisplay
        </th>
        <th>
            @Html.ActionLink((string)ViewBag.AuthorDisplay,"Index", new{sortOrder = ViewBag.AuthorSortParam})
        </th>
        <th>
            @ViewBag.ThumbnailDisplay
        </th>
        <th>
            @Html.ActionLink((string)ViewBag.PriceDisplay,"Index", new{sortOrder = ViewBag.PriceSortParam})
        </th>
        <th>
            @Html.ActionLink((string)ViewBag.PublishedDisplay,"Index", new{sortOrder = ViewBag.PublishedSortParam})
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Title)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Isbn)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Summary)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Author)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Thumbnail)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Price)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Published)
        </td>
        <td>
            @Html.ActionLink((string)ViewBag.EditLink, "Edit", new { id = item.Id }) |
            @Html.ActionLink((string)ViewBag.DetailLink, "Details", new { id = item.Id }) |
            @Html.ActionLink((string)ViewBag.DeleteLink, "Delete", new { id = item.Id })
        </td>
    </tr>
}

</table>
